import { config, parseParams } from '../../utils'
import request from '../../utils/request';
//
//根据菜单id查询数据
export function findNameById({ id }) {
  if(config.isDev){
    return request('http://localhost:63343/configcreate/json/muens.json');
  } else {
    var tmpData = request(config.CADILLAC_URL + '/menuController/getMenuById?id=' + id, {
      credentials: 'include',
      mode: 'no-cors',
    });
    return tmpData;
  }
}
//根据菜单id获取配置数据
export function getPageConfigure({ id }) {
  if(config.isDev){
    return request('http://localhost:63343/configcreate/json/configTwo.json');
  } else {
    var tmpData = request(config.CONFIGURE + '/pageConfigure/getPageConfigure?id=' + id, {
      credentials: 'include',
      mode: 'no-cors',
    });
    return tmpData;
  }
}
//保存根据菜单id获取配置数据
export function savePageConfigure(param) {
  var tmpData = request(config.CONFIGURE+'/pageConfigure/savePageConfigure?pageConfigure=' + JSON.stringify(param), {
    credentials:'include',
    mode: 'no-cors'
  });
  return tmpData;
}
